package com.example.makerspace.controller.project;

import com.example.makerspace.dto.Result;
import com.example.makerspace.dto.maker.AreaBaseDTO;
import com.example.makerspace.dto.project.ProjectTypeBaseDTO;
import com.example.makerspace.service.AreaService;
import com.example.makerspace.service.ProjectTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@ResponseBody
@RequestMapping("/api/type")
public class ProjectTypeController {

    @Autowired
    private ProjectTypeService projectTypeService;

    @PostMapping("/create")
    public Result create(@RequestBody ProjectTypeBaseDTO projectTypeBaseDTO) {
        return projectTypeService.create(projectTypeBaseDTO);
    }

    @GetMapping("/query")
    public Result query(){
        return projectTypeService.query();
    }

    @PostMapping("/delete")
    public Result delete(@RequestBody ProjectTypeBaseDTO projectTypeBaseDTO){
        return projectTypeService.delete(projectTypeBaseDTO.getId());
    }

    @PostMapping("/update")
    public Result update(@RequestBody ProjectTypeBaseDTO projectTypeBaseDTO){
        return projectTypeService.update(projectTypeBaseDTO);
    }
}
